home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / Libraries / SAT 2.3.7 / TCL and demo / SAT-TCL / SATTCLIntf.p < prev   
Encoding:
Text File  |  1995-12-18  |  5.3 KB  |  145 lines  |  [TEXT/PJMM]

  1. {****************************************************}
  2. {}
  3. {        SATTCLIntf.p                                                                                                                                                                                                    }
  4. {}
  5. {        Interface file for the classes by which the THINK Class Library can be used            }
  6. {        with the Sprite Animation Toolkit.                                                                                                                                     }
  7. {}
  8. {        The interface is deliberately kept minimal, making TCL work with SAT, rather    }
  9. {        than the other way around. Commands to SAT are activated using the usual             }
  10. {        SAT* type commands. Sprites are treated in the same way as    for other SAT     }
  11. {        projects.                                                                                                                                                                                                                    }
  12. {}
  13. {        SAT-TCL                                                                                                                                                                                                                    }
  14. {        Copyright © 1995 by Patrick C Hew. All rights reserved.                                                                }
  15. {        Use of this package follows the same restrictions as for SAT.                                                    }
  16. {}
  17. {        Sprite Animation Toolkit                                                                                                                                                                    }
  18. {        Copyright © 1992-1994 by Ingemar Ragnemalm. All rights reserved.                            }
  19. {        See documentation for licensing details and the restrictions on use.                                    }
  20. {}
  21. {        THINK Class Library                                                                                                                                                                                }
  22. {        Copyright © 1989 by Symantec Corporation.  All rights reserved.                                        }
  23. {}
  24. {        Revision History:                                                                                                                                                                                        }
  25. {}
  26. {        Version:    1.00 for TCL 1.1.2 and SAT 2.3b4                                                                                                            }
  27. {        Date:             20 December 1995                                                                                                                                                        }
  28. {        Author:        Patrick C Hew     <phew@ucc.gu.uwa.edu.au>                                                                                }
  29. {        Notes:            Initial release - CSATDirector and CSATPane .                                                                        }
  30. {}
  31. {****************************************************}
  32.  
  33.  
  34. unit SATTCLIntf;
  35.  
  36. interface
  37.  
  38.     uses
  39.         TCL, SAT;
  40.  
  41.  
  42. {****************************************************}
  43. {}
  44. {        CSATDirector                                                                                                                                                                                                    }
  45. {}
  46. {        Director class for use with the Sprite Animation Toolkit. This class isolates a    }
  47. {        number of methods which should be overridden for particular applications.                }
  48. {}
  49. {        This object can be used as a model for overriding CDocument or some other         }
  50. {        director, should that be desired.                                                                                                                                            }
  51. {}
  52. {        Important: Only one instance of this class should exist, namely the director            }
  53. {        which supervises the window containing CSATPane. Remember that SAT is            }
  54. {        designed for a single rectangle of animation in a single window.                                                }
  55. {}
  56. {****************************************************}
  57.  
  58.     type
  59.         CSATDirector = object(CDirector)
  60.  
  61.                 { This variable should point to the single instance of CSATPane. }
  62.                 itsSATPane: CSATPane;
  63.  
  64.                 { Initialization. }
  65.                 procedure ISATDirector (aSupervisor: CApplication);
  66.  
  67.                 { Calls SATSoundShutup. This might be a good place to dispose of the sprites. }
  68.                 procedure Free;
  69.                 override;
  70.  
  71.                 { BuildWindow should build the window, and create the single instance }
  72.                 { of CSATPane. You must assign itsSATPane to point to it.    }
  73.                 procedure BuildWindow;
  74.  
  75.                 { You can call SAT to set up your sprites and sounds in these methods. }
  76.                 { SAT must already be initialized before you can do so. In other words, }
  77.                 { you should probably call BuildWindow first. }
  78.                 procedure SetUpSprites;
  79.  
  80.                 procedure SetUpSounds;
  81.  
  82.                 { SAT is designed for writing games, and envisages having SATRun }
  83.                 { being called repeatedly within a dedicated "game loop". The following  }
  84.                 { three methods are in preparation for this model. }
  85.                 { Another option is to put SATRun in the director's Dawdle method, }
  86.                 { using the normal event loop, but this is very slow. }
  87.  
  88.                 { Do tasks prior to the game loop. The default method fools itsSATPane }
  89.                 { into refreshing itself, so that SAT can modify the contents whilst    }
  90.                 { knowing that the ports are set correctly. }
  91.                 procedure PrepareForPlaying;
  92.  
  93.                 { This should be the game loop. }
  94.                 procedure DoPlay;
  95.  
  96.                 { Clean up after playing. }
  97.                 procedure FinishPlaying;
  98.  
  99.             end;
  100.  
  101.  
  102. {****************************************************}
  103. {}
  104. {        CSATPane                                                                                                                                                                                                                }
  105. {}
  106. {        Panorama class for use with the Sprite Animation Toolkit. This basically call        }
  107. {        SATCustomInit to set up the animation area, and implements it in a panorama.    }
  108. {}
  109. {        The bounds of the panorama are the rectangle specified to SAT. The other               }
  110. {        parameters are as per SAT. We ignore the options for centering the drawing        }
  111. {        area and filling the screen, since these are handled by the window class and         }
  112. {        the decorator class (if used).                                                                                                                                                        }
  113. {}
  114. {        Important: Only one instance of this class should exist. This is where SAT                }
  115. {        thinks that its drawing area is.                                                                                                                                                }
  116. {}
  117. {****************************************************}
  118.  
  119.     { Synonyms for some of the parameters. }
  120.  
  121.     const
  122.         kUseMenuBar = TRUE;
  123.         kNoUseMenuBar = FALSE;
  124.         kDither4Bit = TRUE;
  125.         kNoDither4Bit = FALSE;
  126.         kBeSmart = TRUE;
  127.         kNoBeSmart = FALSE;
  128.  
  129.     type
  130.         CSATPane = object(CPanorama)
  131.  
  132.                 procedure ISATPane (anEnclosure: CView; aSupervisor: CBureaucrat; aWidth, aHeight, aHEncl, aVEncl: Integer; aHSizing, aVSizing: SizingOption; aPICTColor, aPICTBW: Integer; aSATRect: Rect; aUseMenuBar, aDither4bit, aBeSmart: Boolean);
  133.  
  134.                 procedure Draw (var area: Rect);
  135.                 override;
  136.  
  137.                 { Sets up the pane so that SAT can do what it likes without TCL }
  138.                 { doing strange things. }
  139.                 procedure PrepareForSATRun;
  140.  
  141.             end;
  142.  
  143. implementation
  144.  
  145. end. { SATTCLIntf }